package controllers.notify;

import hprose.HproseClinetService;

import java.io.File;
import java.util.HashMap;
import java.util.Map;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;

import component.UserBis;
import constants.APIConstants;
import constants.Constants;
import controllers.common.filter.BaseFilter;
import play.Logger;
import play.mvc.Controller;
import utils.convert.Convert;
import utils.date.DateUtils;
import utils.logs.LogsUtils;

public class NotifyAction extends BaseFilter {
	
	
	public static void index(){
		 render();
	} 
	
	public static void getMessageSet(){	
		Map<String, Object> map = new HashMap<String, Object>();
		Object[] arguments = new Object[] { map };
		map.put("customer_id", UserBis.currUser());
		String data = HproseClinetService.synCall(APIConstants.MSSMI_GETMESSAGESENDSETLIST, arguments,APIConstants.CUSTOMER_HOST, APIConstants.CUSTOMER_PORT);
		renderJSON(data);
	}
	
	public static void setMessageSet(){
		String data = params.get("data");
		Logger.info(data);
		Map<String, Object> map = new HashMap<String, Object>();
		Object[] arguments = new Object[] { map };
		map.put("customer_id", UserBis.currUser());
		map.put("setList", data);
		LogsUtils.addLogs(Constants.LOG_TYPE_UPDATE,Convert.convertToInt(UserBis.currOperatorId(),-1), 1, "执行通知方式修改","success", UserBis.currLoginAccount(), UserBis.currUserName(), UserBis.currUser());
		String res = HproseClinetService.synCall(APIConstants.MSSMI_SETMESSAGESEND, arguments,APIConstants.CUSTOMER_HOST, APIConstants.CUSTOMER_PORT);
		renderJSON(res);
	}
	
}
